<template>
	<view class="bg min100 plr-30 pt-40">
		<view class="size-32  white mb-30">
			填写实名认证信息
		</view>
		<view class="white size-26 mb-40">
			<view class="mb-20">
				您的实名认证信息将用于完成必要的安全检查，以提升你的帐号安全性。</br>
				证件信息绑定后将不能修改，请填写本人实名信息，如非本人实名将无法提现，账号丢失也将无法找回账号。
			</view>
		</view>
		<view class="bg-1 radius-20 plr-30">
			<u-field v-model="info.name" input-align="right" :disabled="info.is_auth==1" label="真实姓名" placeholder-style="color:#999"
				placeholder="请输入您的真实姓名">
			</u-field>
			<u-field v-model="info.card" input-align="right" :disabled="info.is_auth==1" label="身份证号" placeholder-style="color:#999"
				:border-bottom="false" placeholder="请输入您的身份证号码">
			</u-field>
		</view>
		<u-button class="mt-80 btn" hover-class="none" :disabled="info.is_auth==1" @click="userAuth">提交</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {}
			}
		},
		onShow() {
			this.init();
		},
		methods: {
			init() {
				this.$http('api/user/userInfo').then(res => {
					this.info = res;
				})
			},
			userAuth() {
				if (this.info.name == '') {
					uni.showToast({
						title: "请输入真实姓名!",
						icon: 'none'
					})
					return;
				}
				if (this.info.card == '') {
					uni.showToast({
						title: "请输入身份证号!",
						icon: 'none'
					})
					return;
				}
				this.$http('api/user/userAuth', {
					name: this.info.name,
					card: this.info.card
				}, "POST").then(res => {
					uni.showToast({
						title: "提交成功!"
					})
					setTimeout(() => {
						uni.navigateTo({
							url: './editUser'
						})
					}, 500)
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.bg-1 {
		background-color: #fff;
	}
	.white {
		color: #3c3c3c;
	}
	/deep/ .u-field {
		color: #3c3c3c !important;
		font-size: 26rpx;
	}

	/deep/ .u-btn--primary--disabled {
		background: #dedede !important;
	}
	/deep/ .u-field {
		padding: 30rpx 0 !important;
	}
	.btn {
		color: #fff;
		font-size: 30rpx;
		height: 88rpx !important;
		background: linear-gradient(90deg, #EEA634, #DE2D32);
		border-radius: 44rpx;
		&::after {
			border: none;
		}
		&[disabled]:not([type]) {
			color: #dedede;
		}
	}
</style>
